package com.study.model.pojo.HRpojo;

import java.io.Serializable;
import javax.persistence.*;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the app_tab database table.
 * 
 */
@Entity
@Table(name="app_tab")
@NamedQuery(name="AppTab.findAll", query="SELECT a FROM AppTab a")
public class AppTab implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int appid;

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Temporal(TemporalType.TIMESTAMP)
	private Date appdate;
	
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Temporal(TemporalType.TIMESTAMP)
	private Date appemployment;

	private int appnum;

	private int appnumed;

	private String apppost;

	private String appremark;

	private int appstate;

	private int deptid;

	private String empid;

	private String postrequire;

	@ManyToOne
	@JoinColumn(name="deptid")
	private DeptTab deptTab;
	
	@ManyToOne
	@JoinColumn(name="empid")
	private EmpTab empTab;
	
	//bi-directional many-to-one association to ResumeTab@
	@JsonIgnore
	@OneToMany(mappedBy="appTab")
	private List<ResumeTab> resumeTabs;

	public AppTab() {
	}

	public int getAppid() {
		return this.appid;
	}

	public void setAppid(int appid) {
		this.appid = appid;
	}

	public Date getAppdate() {
		return this.appdate;
	}

	public void setAppdate(Date appdate) {
		this.appdate = appdate;
	}

	public Date getAppemployment() {
		return this.appemployment;
	}

	public void setAppemployment(Date appemployment) {
		this.appemployment = appemployment;
	}

	public int getAppnum() {
		return this.appnum;
	}

	public void setAppnum(int appnum) {
		this.appnum = appnum;
	}

	public int getAppnumed() {
		return this.appnumed;
	}

	public void setAppnumed(int appnumed) {
		this.appnumed = appnumed;
	}

	public String getApppost() {
		return this.apppost;
	}

	public void setApppost(String apppost) {
		this.apppost = apppost;
	}

	public String getAppremark() {
		return this.appremark;
	}

	public void setAppremark(String appremark) {
		this.appremark = appremark;
	}

	public int getAppstate() {
		return this.appstate;
	}

	public void setAppstate(int appstate) {
		this.appstate = appstate;
	}

	public int getDeptid() {
		return this.deptid;
	}

	public void setDeptid(int deptid) {
		this.deptid = deptid;
	}

	public String getEmpid() {
		return this.empid;
	}

	public void setEmpid(String empid) {
		this.empid = empid;
	}

	public String getPostrequire() {
		return this.postrequire;
	}

	public void setPostrequire(String postrequire) {
		this.postrequire = postrequire;
	}

	public List<ResumeTab> getResumeTabs() {
		return this.resumeTabs;
	}

	public void setResumeTabs(List<ResumeTab> resumeTabs) {
		this.resumeTabs = resumeTabs;
	}
	
	public DeptTab getDeptTab() {
		return deptTab;
	}

	public void setDeptTab(DeptTab deptTab) {
		this.deptTab = deptTab;
	}

	public EmpTab getEmpTab() {
		return empTab;
	}

	public void setEmpTab(EmpTab empTab) {
		this.empTab = empTab;
	}

	public ResumeTab addResumeTab(ResumeTab resumeTab) {
		getResumeTabs().add(resumeTab);
		resumeTab.setAppTab(this);

		return resumeTab;
	}

	public ResumeTab removeResumeTab(ResumeTab resumeTab) {
		getResumeTabs().remove(resumeTab);
		resumeTab.setAppTab(null);

		return resumeTab;
	}

	@Override
	public String toString() {
		return "AppTab [appid=" + appid + ", appdate=" + appdate + ", appemployment=" + appemployment + ", appnum="
				+ appnum + ", appnumed=" + appnumed + ", apppost=" + apppost + ", appremark=" + appremark
				+ ", appstate=" + appstate + ", postrequire=" + postrequire + ", deptTab=" + deptTab + ", empTab="
				+ empTab + ", resumeTabs=" + resumeTabs + "]";
	}

}